package com.ug.system.entity;

import us.codecraft.webmagic.ResultItems;
import us.codecraft.webmagic.Task;
import us.codecraft.webmagic.pipeline.CollectorPipeline;

import java.util.ArrayList;
import java.util.List;

/**
 * @author: LY
 * @description: 页面属性值
 */
public class HtmlAttributeValue implements CollectorPipeline<AttributeValue>{

    /**
     * 属性值集合
     */
    private final List<AttributeValue> collector = new ArrayList<>();

    @Override
    public List<AttributeValue> getCollected() {
        return collector;
    }

    @Override
    public void process(ResultItems resultItems, Task task) {
        collector.addAll(resultItems.get("attributeValues"));
    }
}
